package main

import (
	"fmt"
)

// 在golang中没有继承
type People struct{}

func (p *People) ShowA() {
	fmt.Println("showA")
	p.ShowB()
}

func (p *People) ShowB() {
	fmt.Println("showB")
}

// 组合
type Teacher struct {
	People
}

func (t *Teacher) ShowA() {
	fmt.Println("Teacher showA")
}

func (t *Teacher) ShowB() {
	fmt.Println("teacher showB")
}

func main() {
	t := Teacher{}
	// 下面两种写法等价
	//t.ShowA()
	t.People.ShowA();
}